home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
501_600
/
DISK0510
/
DISK0510.ZIP
/
PATTERN
< prev
next >
Wrap
Text File
|
1985-08-08
|
1KB
|
51 lines
PROGRAM PATTERN; {this demo prints a pattern of characters on the screen,}
{in normal and inverse video}
CONST
NORM = 0; {screen attribute}
REVERSED = 7;
VAR
CHARACT : CHAR;
ATTRIBUTE : INTEGER;
XPOSITION,YPOSITION : INTEGER;
DUM1,DUM2:INTEGER;
PROCEDURE SWITCH_ATTR; {between normal and reversed video}
BEGIN
CASE ATTRIBUTE OF
NORM : ATTRIBUTE := REVERSED;
REVERSED : ATTRIBUTE := NORM;
END;
WRITE(CHR(27), '[', ATTRIBUTE:1, 'm');
END;
PROCEDURE SETCURSOR(XPOS, YPOS : INTEGER);
BEGIN
CURSOR(XPOS+YPOS-16,YPOS);
DUM1 := XPOS;
DUM2 := YPOS;
END;
BEGIN {-----------------main line of program------------------------}
{write a pattern of characters on the terminal, varying the attribute
{and position.}
CLS;
ATTRIBUTE := NORM;
FOR XPOSITION := 10 TO 30 DO
BEGIN
SWITCH_ATTR;
FOR YPOSITION := 16 TO 22 DO
BEGIN
CHARACT := CHR(32+XPOSITION);
SETCURSOR(XPOSITION, YPOSITION);
WRITE(CHARACT);
END;
END;
ATTRIBUTE := REVERSED;
SWITCH_ATTR;
END.